package com.example.mqproduce.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author taritari
 * @date 2023-11-29 16:25
 * @description
 */
@Configuration
public class DeadRabbitMqConfiguration {
    //声明交换机注册direct模式的交换机
    @Bean
    public DirectExchange deadExchange(){
        return new DirectExchange("dead_direct_exchange",true,false);
    }
    //声明队列 sms.fanout.queue email.fanout.queue duanxin.fanout.queue
    @Bean
    public Queue deadQueue(){
        return new Queue("dead.direct.queue",true);
    }

    //完成绑定关系
    @Bean
    public Binding deadBingDing(){
        return BindingBuilder.bind(deadQueue()).to(deadExchange()).with("dead");
    }

}
